
let ul=document.querySelector('.main ul')
console.log(localStorage.getItem('productid'));
let xhr =new XMLHttpRequest()
xhr.open('get',`http://chst.vip:1234/api/getdiscountproduct?productid=${localStorage.getItem('productid')}`,true)
xhr.onload=function(){
    if(xhr.status===200){
        let res =JSON.parse(xhr.responseText)
        let an=res.result
        let lis=''
        console.log(an);
        an.forEach(item => {
            lis+=`
            <li>
            <p>${item.productName}</p>
            <span>${item.productFrom} | ${item.productTime}</span>
            <span>${item.productTips}</span>
            <p>
                ${item.productInfo}
            </p>
            ${item.productImg}
      
            <p>前往购买</p>
            
            <img src="http://chst.vip:8081/for-stu/wfzh/images/mmbweixin2.png" alt="">
            <input type="text" >

            <div>
                <p></p>
                <p>提交评论</p>
            </div>
        </li>
            `  
        });
        ul.innerHTML=lis   
     
    }
}
xhr.send(null)